package com.todod.base.framework.common.pojo;

import com.todod.base.framework.common.exception.ErrorCode;
import lombok.Data;

import java.io.Serializable;
import java.util.Map;

@Data
public class MyCommonResult<T> implements Serializable {
    /**
     * 错误码
     *
     * @see ErrorCode#getCode()
     */
    private Integer code;
    /**
     * 返回数据
     */
    private T data;
    /**
     * 错误提示，用户可阅读
     *
     * @see ErrorCode#getMsg() ()
     */
    private String msg;


    public MyCommonResult(Map<String, Object> result) {
        this.code = (Integer) result.get("code");
        this.msg = (String) result.get("msg");
        this.data = (T) result.get("data");
    }
}
